package com.woniu.liuzhougov.relatedinformation.service.impl;

import com.woniu.liuzhougov.relatedinformation.dao.CityMapper;
import com.woniu.liuzhougov.relatedinformation.pojo.City;
import com.woniu.liuzhougov.relatedinformation.service.RelatedInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description: desc
 * @author: Chris
 * @createDate: 2019/4/24 0024
 * @version: 1.0
 */
@Service("cityService")
public class CityServiceImpl implements RelatedInformationService<City> {

    @Autowired
    private CityMapper cityMapper;

    @Override
    public List<City> selectList() {
        return cityMapper.selectList();
    }

    @Override
    public List<City> selectByName(String name) {
        return cityMapper.selectByName(name);
    }

    @Override
    @Transactional
    public int deleteById(Integer id) {
        return cityMapper.deleteByPrimaryKey(id);
    }

    @Override
    public City selectById(Integer id) {
        return cityMapper.selectByPrimaryKey(id);
    }

    @Override
    @Transactional
    public int insert(City city) {
        return cityMapper.insert(city);
    }

    @Override
    @Transactional
    public int update(City city) {
        return cityMapper.updateByPrimaryKey(city);
    }
}
